﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThietBiSo.LinQDB;

namespace ThietBiSo.Models
{
    public class MGioiThieu
    {
        private _24hmuaonlineDataContext context = new _24hmuaonlineDataContext();
        public string FindAll()
        {
            var v = from f in context.GioiThieus select f.NoiDUng;

            return v.FirstOrDefault();
        }
        public GioiThieu FindAll_Web()
        {
            var v = from f in context.GioiThieus select f;
            return v.FirstOrDefault();
        }
        public void Save(GioiThieu bv)
        {
            context.GioiThieus.InsertOnSubmit(bv);
            context.SubmitChanges();
        }
        public void Update(GioiThieu bv)
        {
            var v = from f in context.GioiThieus
                    select f;
            GioiThieu bvdb = v.SingleOrDefault(d => d.Id.Equals(bv.Id));
            
            bvdb.NoiDUng = bv.NoiDUng;
            context.SubmitChanges();
        }
       
    }
}